<template>
	<view class="leave-box">
		<view v-if="list.length==0" style="text-align: center;">
			<image src="../../static/nodata.png" class="nodata_img" ></image>
		</view>
		<view class="leave-content" v-if="list.length>0" @click="qingjiaDetails(item.leave_id)" v-for="(item,index) in list" :key="index">
			<view class="leave-content-left">
				<view class="leave-content-left-top">
					<view class="leave-content-name ">{{ item.name }}</view>
					<view class="leave-content-classnumber ">学号：{{ item.sno }}</view>
				</view>
				<view class="leave-content-time">
					<view class="leave-tiem ">请假时间：（总时长{{item.hours}}小时）</view>
					<view class="leave-date ">{{item.begintime?item.begintime.substring(0,16):''}} 至 
																							 {{item.endtime?item.endtime.substring(0,16):''}}</view>
				</view>
			</view>
			<!-- <view class="leave-content-right">
				<view class="leave-content-right-box zhengwen1">请假中</view>
			</view> -->
		</view>
		
	</view>
</template>

<script>
	export default{
		data(){
			return{
				name:'张三',
				id:'0000001',
				list:[]
			}
		},
		mounted(){
			// 请求接口 ↓↓↓
			//查询教师端请假中的列表数据
			uni.request({
				url: this.baseUrl+ "/appteacher/getLeaveingTeacherDataDetails?satoken="+uni.getStorageSync('satoken'),
				// url: this.baseUrl+ "/appteacher/getLeaveDetails?satoken="+uni.getStorageSync('satoken'),
				method: "POST",
				headers: {
					// "token": localStorage.getItem("token")
				},
				data: {
				        page: '1',
						length: '20'
				    },
				success:(res) => { 
					console.log(res.data)
					this.list = res.data.page.list
				}
			})
		},
		methods:{
			qingjiaDetails(id){
				uni.navigateTo({
					url: '/pages/qingjiazhongDetails/qingjiazhongDetails?id='+id
				});
				
			}
		}
		
		
	}
</script>

<style lang="scss">
	@import url(@/static/common.css);
	/* .chulizhong-box{
		width: 95%;
		margin: 0 auto;
		overflow: hidden;
		.leave-content{
			width: 100%;
			display: flex;
			box-sizing: border-box;
			background-color: #ffffff;
			flex-direction: row;
			align-items: center;
			margin-top: 30rpx;
			padding: 30rpx 0;
			padding-left: 20rpx;
			border-bottom: 1rpx solid #999999;
			.leave-content-left{
				flex: 2;
				display: flex;
				flex-direction: column;
				font-size: 48rpx;
				.leave-content-left-top{
					display: flex;
					flex-direction: row;
					// font-size: 28rpx;
					.leave-content-name{
						margin-right: 30rpx;
					}
				}
				.leave-content-time{
					// font-size: 24rpx;
					display: flex;
					flex-direction: column;
					margin-top: 20rpx;
					.leave-tiem{
						
						margin-bottom: 10rpx;
					}
					.leave-date{
						letter-spacing: 1rpx;
					}
					
				}
				
			}
			.leave-content-right{
				flex: 1;
				.leave-content-right-box{
					width: 200rpx;
					height: 100rpx;
					background-color: #f5f5f5;
					display: flex;
					align-items: center;
					justify-content: center;
					// font-size: 28rpx;
				}
				
			}
		}
	} */
	
	
</style>